#include <cstdio>
#include <iostream>
#include <set>
#include <string>
using namespace std;

int n;
set< string > bst;
int main() {
	freopen("find.in", "r", stdin);
	freopen("find.out", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	char opt = 0;
	string s;
	for (int i = 0; i < n; ++i) {
		cin >> opt;
		cin >> s;
		switch (opt) {
		case 'I':
			bst.insert(s);
			break;
		case 'F':
			if (bst.find(s) != bst.end()) {
				puts("YES");
			} else {
				puts("NO");
			}
		}
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}